package com.decent.core.alarm.dao;

import com.decent.common.entity.alarm.AlarmTemplate;
import com.decent.common.enums.CommonStatusEnum;
import com.decent.common.enums.alarm.AlarmTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author 王雪杰
 * @date 2022/3/28
 */
@Mapper
public interface AlarmCoreDao {
    /**
     * 根据消息类型查询报警模板
     *
     * @param sendType       消息类型
     * @param templateStatus 模板状态 ON/OFF
     * @return template
     */
    @Select(" SELECT t.id, t.template_name, t.url, t.business_type, t.send_channel, t.content_prefix, " +
            "  t.template_content AS templateContent, t.send_type, t.template_status " +
            " FROM alarm_template AS t " +
            " WHERE t.send_type = #{sendType} " +
            " AND t.template_status = #{templateStatus} ")
    AlarmTemplate queryTemplate(@Param("sendType") AlarmTypeEnum sendType,
                                @Param("templateStatus") CommonStatusEnum templateStatus);
}
